import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;


public class DeviceMenu extends JPanel {
	private IdMenu idMenu;
	private NumberOfDevice numberDev;
	/**
	 * @return the idMenu
	 */
	public IdMenu getIdMenu() {
		return idMenu;
	}

	/**
	 * @param idMenu the idMenu to set
	 */
	public void setIdMenu(IdMenu idMenu) {
		this.idMenu = idMenu;
	}

	/**
	 * Create the panel.
	 */
	public DeviceMenu() {
		idMenu = new IdMenu();
		add(idMenu);
		numberDev = new NumberOfDevice();
		add(numberDev);
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(idMenu, GroupLayout.PREFERRED_SIZE, 142, GroupLayout.PREFERRED_SIZE)
					.addGap(39)
					.addComponent(numberDev, GroupLayout.PREFERRED_SIZE, 169, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(88, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(44)
					.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
						.addComponent(numberDev, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(idMenu, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
					.addContainerGap(199, Short.MAX_VALUE))
		);
		setLayout(groupLayout);
		
	}
	
	public String[] getSetting(){
		String[] s = new String[2];
		
		s[0] = (String) idMenu.getSelectedItem();
		s[1] = (String) Integer.toString((Integer) numberDev.getValue());
		
		return s;
		}

	public void setSetting(String[] s){
		
		idMenu.setSelectedItem(s[0]);
		numberDev.setValue(Integer.parseInt(s[1]));
	}
	
	/**
	 * @return the numberDev
	 */
	public NumberOfDevice getNumberDev() {
		return numberDev;
	}

	/**
	 * @param numberDev the numberDev to set
	 */
	public void setNumberDev(NumberOfDevice numberDev) {
		this.numberDev = numberDev;
	}
}
